package com.lm.calcite.controller;


import com.lm.calcite.service.CalciteQueryService;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/calcite")
public class QueryController {

    private final CalciteQueryService queryService;

    public QueryController(CalciteQueryService queryService) {
        this.queryService = queryService;
    }

    @GetMapping("/query")
    public List<Map<String, Object>> query(@RequestParam String sql) {
        return queryService.query(sql);
    }
}